package tst.gwt.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.MultiWordSuggestOracle;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.SuggestBox;
import com.google.gwt.user.client.ui.Widget;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class SuggestBoxExample implements EntryPoint {

  private static final String[] words = new String[] { "1337", "apple",
	"about", "ant", "bruce", "banana", "bobv", "canada", "coconut",
	"compiler", "donut", "deferred binding", "dessert topping",
	"eclair", "ecc", "frog attack", "floor wax", "fitz", "google",
	"gosh", "gwt", "hollis", "haskell", "hammer", "in the flinks",
	"internets", "ipso facto", "jat", "jgw", "java", "jens", "knorton",
	"kaitlyn", "kangaroo", "la grange", "lars", "love", "morrildl",
	"max", "maddie", "mloofle", "mmendez", "nail", "narnia", "null",
	"optimizations", "obfuscation", "original", "ping pong",
	"polymorphic", "pleather", "quotidian", "quality",
	"qu'est-ce que c'est", "ready state", "ruby", "rdayal",
	"subversion", "superclass", "scottb", "tobyr", "the dans",
	"~ tilde", "undefined", "unit tests", "under 100ms", "vtbl",
	"vidalia", "vector graphics", "w3c", "web experience",
	"work around", "w00t!", "xml", "xargs", "xeno", "yacc",
	"yank (the vi command)", "zealot", "zoe", "zebra" };

  private MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();

  private SuggestBox suggestBox = new SuggestBox(oracle);

  /**
	 * This is the entry point method.
	 */
  public void onModuleLoad() {
    for (int i = 0; i < words.length; ++i) {
        oracle.add(words[i]);
    }
    RootPanel.get("slot1").add(suggestBox);
  }
}
